Skip to content

Instantly share code, notes, and snippets.

@calebrob6
calebrob6 / sam_inference.py
Last active May 22, 2024 02:20
Runs inference on large satellite image scenes with SAM models
# Requires the `segment-geospatial` package https://samgeo.gishub.org/
import argparse
import os
import cv2
import numpy as np
import rasterio
import rasterio.features
import rasterio.transform
import rasterio.windows
@rphlmr
rphlmr / clear-db.ts
Last active May 22, 2024 02:20
Drizzle snippets
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406
import { sql } from "drizzle-orm";
const clearDb = async (): Promise<void> => {
const query = sql<string>`SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
`;
@SkyN9ne
SkyN9ne / expl_msr_ko.py
Created May 22, 2024 02:19 — forked from Cr4sh/expl_msr_ko.py
msr.ko Linux kernel lockdown bypass PoC
import sys, os, mmap, subprocess
from struct import pack, unpack
from ctypes import *
IA32_SYSENTER_ESP = 0x175
IA32_SYSENTER_EIP = 0x176
class PyObj(Structure):
_fields_ = [( 'ob_refcnt', c_size_t ),
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 22, 2024 02:19
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@Cr4sh
Cr4sh / expl_msr_ko.py
Created July 1, 2020 23:32
msr.ko Linux kernel lockdown bypass PoC
import sys, os, mmap, subprocess
from struct import pack, unpack
from ctypes import *
IA32_SYSENTER_ESP = 0x175
IA32_SYSENTER_EIP = 0x176
class PyObj(Structure):
_fields_ = [( 'ob_refcnt', c_size_t ),
@p3t3r67x0
p3t3r67x0 / openssl_commands.md
Last active May 22, 2024 02:19
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 22, 2024 02:19
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@theodric
theodric / kvm-passthrough-notes
Last active May 22, 2024 02:17
Notes on device passthrough configuration for KVM hosts
2024 ADDENDUM TO BELOW NOTES:
1. I have found that the linux-amd-znver3 kernel reliaby works for passthrough, initializing devices in a sane order and respecting boot-time blacklist kernel args https://aur.archlinux.org/packages/linux-amd-znver3
2. I have since managed to get the Nvidia RTX A2000 12GB working in passthrough with a few different settings which I will document here Real Soon Now, I Swear™.
3. The RTX 4000 SFF Ada Generation 20GB works as a drop-in replacement for the A2000.
4. Stability is not guaranteed - I don't know what to blame, but it's infrequent enough (i.e. one crash every few months) that I haven't spent time on it.
5. I have recently transitioned away from Arch to openSUSE Tumbleweed, which works out-of-the-box as a passthrough host and does not constantly break.
6. I am separately maintaning a variant of the linux-amd-znver3 and linux-amd-znver2 configs which have been tweaked to work on openSUSE. I can share these or even provide builds if there is interest.
2022 NOTES - FULLY WOR
@bmaupin
bmaupin / free-backend-hosting.md
Last active May 22, 2024 02:17
Free backend hosting
@Cr4sh
Cr4sh / smm_backdoor_privesc_linux.py
Last active May 22, 2024 02:17
Example program that uses SMM backdoor for local privileges escalation under the Linux
#!/usr/bin/env python
import sys, os, platform, ctypes
from struct import pack, unpack
import smm_backdoor as bd
try:
import capstone